 <?php

 if(!isset($_POST["status_id"])){
 form_head("report/maintain_list","") ?>
 
		 
	
	
	<?php 
	
		

		 $rows =  $this->db->get("maintain_status")->result_array();
		 select_field("status_id","สถานะแจ้งซ่อม",$rows,"status_name",0,0,"All",1,null,"",2); 
		 
	?>
	
	
	
		  <?php
			
				
				text_field("date1","วันที่",array('date1'=>date('d/m/Y')),0,"date"); ?>
		   <?php text_field("date2","จนถึงวันที่",array("date2"=>date('d/m/Y')),0,"date"); ?>
	<?php form_footer("Filter");

 }
	?>
	
	<?php  if(isset($_POST["status_id"])){
  ?>
 <a target="_blank" href="<?php echo site_url("report/maintain_list_print/$status_id/$date1/$date2"); ?>"><img src="images/print.png">พิมพ์รายงาน</a>
 <table class="list">
          <tbody><tr class=" odd">
           
            <th>เลขที่งานซ่อม</th>
             <th>ชื่อครุภัณฑ์</th>
            <th>หัวเรื่องแจ้งซ่อม</th>
            
           
		   <th>ผู้แจ้ง</th>
		   <th>วันที่แจัง</th>
		  

		      <th>สถานะงานซ่อม</th>
		   
		    <th>พิมพ์ใบส่งซ่อม</th>
		   
		  
          
     
          </tr>
         <?php 
         $i = 1;
         foreach($rows as $row){ ?>
          
          <tr class="<?php if($i++%2){ echo "even";} ?>" >
          
            <td><span><?php echo $row['m_code'] ?></span></td>
              <td><span><?php echo $row['name']; ?></span></td>
             <td><span><?php echo $row['subject']; ?></span></td>
           
          
            <td><span><?php echo $row['firstname'] ?> <?php echo $row['lastname'] ?></span></td>
            <td><span><?php echo $row['create_date']; ?></span></td>
           
        <td><span><?php echo $row['status_name']; ?></span></td>
    <td><a href="<?php echo site_url("report/maintain_print/".$row["maintain_id"]); ?>"><img src="images/print.png" /></a></td>
           
          
          
          </tr>
          <?php } ?>
        </tbody></table>
  
  <?php } ?>